/** \file DbxPrettyPrint.cc
 * Definitions for functions that helps pretty printing for Sun dbx
 *
 * (C) Copyright 2010 by Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: QDecContext.cc 111 2006-06-19 03:45:40Z semihc $
 *
 *
 */

#include <string>
#include <QString>
#include <QStringList>


using namespace std;


//
// Null pointer marker
//
static const char* NullPtr = "NullPtr";



//
// Sun dbx pretty print functions
//


char* db_pretty_print(string* str, int, char*)
{
  if(str)
    return const_cast<char*>( str->data() );
  else
    return const_cast<char*>(NullPtr);
}


char* db_pretty_print(QString* str, int, char*)
{
  static __thread QByteArray ba;

  if(!str) return const_cast<char*>(NullPtr);
  
  ba = str->toAscii();
  return ba.data();
}


char* db_pretty_print(QStringList* strlst, int, char*)
{
  static __thread QByteArray ba;

  if(!strlst) return const_cast<char*>(NullPtr);
  
  ba = strlst->join("|").toAscii();
  return ba.data();
}
